package com.transaction.simulate.service.impl;

import com.transaction.common.util.CodeUtil;
import com.transaction.simulate.mapper.MenuMapper;
import com.transaction.simulate.model.dto.Menu;
import com.transaction.simulate.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service
public class MenuServiceImpl implements MenuService {

    @Autowired
    private MenuMapper menuMapper;


    @Override
    @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
    public void addMenu(Menu menu) {
        menu.setMenuCode(CodeUtil.getCode());
        menuMapper.addMenu(menu);
    }
}
